 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _5LabaNumber2
{
    public partial class Form1 : Form
    {
        Data data;
        Necklace unit;
        Logger ilog;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            data = new Data();
            unit = new Necklace();
            data.BindCreators();
            data.BindDate();
            label5.Text = "Цена ожерелья: None;";
            label6.Text = "Вес ожерелья: None;";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex != -1 && comboBox2.SelectedIndex != -1 && comboBox3.SelectedIndex != -1 && textBox1.Text != "")
            {
                unit.Name = textBox1.Text;
                label5.Text = "Цена ожерелья: " + Convert.ToString(unit.Cost()) + ";";
                label6.Text = "Вес ожерелья: " + Convert.ToString(unit.Weight()) + ";";
                ilog = new Logger();
                ilog.File(unit);
            }
            else
                MessageBox.Show("Вы забыли что-то выбрать!");
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == 0)
            {
                unit.Main_stone = data.main_stone[0];
                mainstone.Text = "Название: " + unit.Main_stone.Name + Environment.NewLine
                    + "Цена: " + unit.Main_stone.Price + Environment.NewLine
                    + "Вес: " + unit.Main_stone.Weight  + Environment.NewLine
                    + "Цвет: " + unit.Main_stone.Color  + Environment.NewLine
                    + "Твердость: " + unit.Main_stone.Hardness +  Environment.NewLine
                    + "Электричество: " + unit.Main_stone.Electricity +  Environment.NewLine
                    + "Прозрачность: " + unit.Main_stone.Transparency;
            }
            if (comboBox1.SelectedIndex == 1)
            {
                unit.Main_stone = data.main_stone[1];
                mainstone.Text = "Название: " + unit.Main_stone.Name + Environment.NewLine
                    + "Цена: " + unit.Main_stone.Price + Environment.NewLine
                    + "Вес: " + unit.Main_stone.Weight + Environment.NewLine
                    + "Цвет: " + unit.Main_stone.Color + Environment.NewLine
                    + "Твердость: " + unit.Main_stone.Hardness + Environment.NewLine
                    + "Электричество: " + unit.Main_stone.Electricity + Environment.NewLine
                    + "Прозрачность: " + unit.Main_stone.Transparency;
            }
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox2.SelectedIndex == 0)
            {
                unit.SecondMain_stone = data.main_stone[2];
                secondmainstone.Text = "Название: " + unit.SecondMain_stone.Name + Environment.NewLine
                    + "Цена: " + unit.SecondMain_stone.Price + Environment.NewLine
                    + "Вес: " + unit.SecondMain_stone.Weight + Environment.NewLine
                    + "Цвет: " + unit.SecondMain_stone.Color + Environment.NewLine
                    + "Твердость: " + unit.SecondMain_stone.Hardness + Environment.NewLine
                    + "Электричество: " + unit.SecondMain_stone.Electricity + Environment.NewLine
                    + "Прозрачность: " + unit.SecondMain_stone.Transparency;
            }
            if (comboBox2.SelectedIndex == 1)
            {
                unit.SecondMain_stone = data.main_stone[3];
                secondmainstone.Text = "Название: " + unit.SecondMain_stone.Name + Environment.NewLine
                    + "Цена: " + unit.SecondMain_stone.Price + Environment.NewLine
                    + "Вес: " + unit.SecondMain_stone.Weight + Environment.NewLine
                    + "Цвет: " + unit.SecondMain_stone.Color + Environment.NewLine
                    + "Твердость: " + unit.SecondMain_stone.Hardness + Environment.NewLine
                    + "Электричество: " + unit.SecondMain_stone.Electricity + Environment.NewLine
                    + "Прозрачность: " + unit.SecondMain_stone.Transparency;
            }
        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox3.SelectedIndex == 0)
            {
                unit.Minor_Stone = data.minor_stone[0];
                minorstone.Text = "Название: " + unit.Minor_Stone.Name + Environment.NewLine
                    + "Цена: " + unit.Minor_Stone.Price + Environment.NewLine
                    + "Вес: " + unit.Minor_Stone.Weight + Environment.NewLine
                    + "Сожержание синтетики: " + unit.Minor_Stone.Content_of_synthetic + Environment.NewLine
                    + "Кол-во изломов: " + unit.Minor_Stone.Count_of_fracture;
            }
            if (comboBox3.SelectedIndex == 1)
            {
                unit.Minor_Stone = data.minor_stone[1];
                minorstone.Text = "Название: " + unit.Minor_Stone.Name + Environment.NewLine
                    + "Цена: " + unit.Minor_Stone.Price + Environment.NewLine
                    + "Вес: " + unit.Minor_Stone.Weight + Environment.NewLine
                    + "Сожержание синтетики: " + unit.Minor_Stone.Content_of_synthetic + Environment.NewLine
                    + "Кол-во изломов: " + unit.Minor_Stone.Count_of_fracture; ;
            }
        }
    }
}
